import basegraphunit from './basegraphunit.js'
import coorPkg from '../../struct/coord.js'

class Terminal extends basegraphunit.BaseGraphUnit {
    constructor() {
        super();
        this.pos = new coorPkg.PointPos();
        this.name = "tm1";
        this.x = 0;
        this.y = 0;
        this.color = 255;
    }

    translateSubInfo(tx,ty){
        this.x += tx;
        this.y += ty;
    }

    toJson() { 
        var jsonobj = {};
        super.toJson(jsonobj);
        jsonobj["x"] = this.x;
        jsonobj["y"] = this.x;
        jsonobj["name"] = this.name;
        jsonobj["color"] = this.color;
        return jsonobj;
    }
    fromJson(obj) { 
        super.commonPropFromJson(obj);
        this.x = obj["x"];
        this.y = obj["y"];
        this.pos.x = this.x;
        this.pos.y = this.y;
        this.name = obj["name"];
        this.color = obj["color"];
    }
    cloneCopy() { }
}

export default { Terminal }